<template>
	<view>
		<image :src="getStaticFilePath(picUrl)" mode="" class="img"></image>
		<view class="btn" @click="go()" v-if="isImgShow">进入</view>
	</view>
</template>

<script lang="ts" setup>
	import { ref } from 'vue';
	import { getLaunchPicService } from '@/api/index.js';
	import { getStaticFilePath } from '@/utils/luch-request/utils.js';
	
	const picUrl = ref('');
	const isImgShow = ref(false);
	
	const getLaunchPic = async () => {
		const res = await getLaunchPicService();
		if(res.data !== {} || res.data !== [] || res.data.length !== 0 ){
			picUrl.value = res.data.thumb;
			isImgShow.value = true;
		}else{
			go();
		}
		
		// console.log('获取首页图列表成功',res);
	}
	const go = () => {
		uni.redirectTo({
			url: '/pages/index/index'
		})
	}
	
	getLaunchPic();
</script>

<style lang="scss" scoped>
	.img{
		width: 100%;
		height: 100vh;
	}
	.btn{
		position: fixed;
		z-index: 2;
		left: 0; right: 0; bottom: mp-sizing(120);
		margin: auto;
		width: mp-sizing(300);
		height: mp-sizing(40);
		border-radius: mp-sizing(20);
		line-height: mp-sizing(40);
		background-color: #ffaa00;
		color: $uni-text-color-inverse;
		font-size: mp-sizing(18);
		font-weight: 600;
		text-align: center;
	}
</style>